<?php
require_once("thamdinh/models/linhvuc.php");
require_once("tracuu/models/tvtkModel.php");
require_once("tracuu/models/tvgsModel.php");
class Tracuu_IndexController extends GenericController {

    // Tu van thiet ke
    public function danhsachtvtkokAction() {
        $this->_helper->layout->disableLayout();
        $params=$this->getRequest()->getParams();
        $config = Zend_Registry::get('config');
        $data= tvtkModel::selectDanhSachTVTKDaCongBo($params);
        if((int)$params['hienthi']>0)
        {
            $paginatorLimit=$params['hienthi'];
        }
        else 
        {
            $paginatorLimit=$config->paginatorLimit;
        }
        $paginatorRange=$config->paginatorRange;
        $paginator = Zend_Paginator::factory($data);
        $paginator->setItemCountPerPage($paginatorLimit);       
        $paginator->setPageRange($paginatorRange);
        $currentPage = $this->getRequest()->getParam('page',1);
        $paginator->setCurrentPageNumber($currentPage);        
        $this->view->data=$paginator;
        $this->view->limit=$paginatorLimit;
        $this->view->page=$currentPage;
        $this->view->params=$params;
        $this->view->linhvuc = LinhVuc::SelectLinhVucList("");
        if($params['paginator']!=null)
        {
            $this->_helper->layout->disableLayout();
            $this->_helper->viewRenderer('index/danhsachtvtkok', null, true);
        }
    }

    public function danhsachtvtknoAction() {
        $this->_helper->layout->disableLayout();
        $params=$this->getRequest()->getParams();
        $config = Zend_Registry::get('config');
        $data= tvtkModel::selectDanhSachTVTKKhongThamDinh($params);
        if((int)$params['hienthi']>0)
        {
            $paginatorLimit=$params['hienthi'];
        }
        else 
        {
            $paginatorLimit=$config->paginatorLimit;
        }
        $paginatorRange=$config->paginatorRange;
        $paginator = Zend_Paginator::factory($data);
        $paginator->setItemCountPerPage($paginatorLimit);       
        $paginator->setPageRange($paginatorRange);
        $currentPage = $this->getRequest()->getParam('page',1);
        $paginator->setCurrentPageNumber($currentPage);        
        $this->view->data=$paginator;
        $this->view->limit=$paginatorLimit;
        $this->view->page=$currentPage;
        $this->view->params=$params;
        $this->view->linhvuc = LinhVuc::SelectLinhVucList("");
        if($params['paginator']!=null)
        {
            $this->_helper->layout->disableLayout();
            $this->_helper->viewRenderer('index/danhsachtvtkno', null, true);
        }
    }

    public function danhsachtvtkkhongcongboAction() {
        $this->_helper->layout->disableLayout();
        $params=$this->getRequest()->getParams();
        $config = Zend_Registry::get('config');
        $data= tvtkModel::selectDanhSachTVTKKhongCongBo($params);
        if((int)$params['hienthi']>0)
        {
            $paginatorLimit=$params['hienthi'];
        }
        else 
        {
            $paginatorLimit=$config->paginatorLimit;
        }
        $paginatorRange=$config->paginatorRange;
        $paginator = Zend_Paginator::factory($data);
        $paginator->setItemCountPerPage($paginatorLimit);       
        $paginator->setPageRange($paginatorRange);
        $currentPage = $this->getRequest()->getParam('page',1);
        $paginator->setCurrentPageNumber($currentPage);        
        $this->view->data=$paginator;
        $this->view->limit=$paginatorLimit;
        $this->view->page=$currentPage;
        $this->view->params=$params;
        $this->view->linhvuc = LinhVuc::SelectLinhVucList("");
        if($params['paginator']!=null)
        {
            $this->_helper->layout->disableLayout();
            $this->_helper->viewRenderer('index/danhsachtvtkkhongcongbo', null, true);
        }
    }
    // Tu van thiet ke
    public function danhsachtvtkAction() {
        $this->_helper->layout->disableLayout();
        $params=$this->getRequest()->getParams();
        $config = Zend_Registry::get('config');
        $data= tvtkModel::selectDanhSachTVTKChoThamDinh($params);
        if((int)$params['hienthi']>0)
        {
            $paginatorLimit=$params['hienthi'];
        }
        else 
        {
            $paginatorLimit=$config->paginatorLimit;
        }
        $paginatorRange=$config->paginatorRange;
        $paginator = Zend_Paginator::factory($data);
        $paginator->setItemCountPerPage($paginatorLimit);       
        $paginator->setPageRange($paginatorRange);
        $currentPage = $this->getRequest()->getParam('page',1);
        $paginator->setCurrentPageNumber($currentPage);        
        $this->view->data=$paginator;
        $this->view->limit=$paginatorLimit;
        $this->view->page=$currentPage;
        $this->view->params=$params;
        $this->view->linhvuc = LinhVuc::SelectLinhVucList("");
        if($params['paginator']!=null)
        {
            $this->_helper->layout->disableLayout();
            $this->_helper->viewRenderer('index/danhsachtvtk', null, true);
        }
    }
    /*
     * *****************************************
     */
    // Tu van thiet ke
    public function danhsachtvgsokAction() {
        $this->_helper->layout->disableLayout();
        $params=$this->getRequest()->getParams();
        $config = Zend_Registry::get('config');
        $data= tvgsModel::selectDanhSachTVGSDaCongBo($params);
        if((int)$params['hienthi']>0)
        {
            $paginatorLimit=$params['hienthi'];
        }
        else 
        {
            $paginatorLimit=$config->paginatorLimit;
        }
        $paginatorRange=$config->paginatorRange;
        $paginator = Zend_Paginator::factory($data);
        $paginator->setItemCountPerPage($paginatorLimit);       
        $paginator->setPageRange($paginatorRange);
        $currentPage = $this->getRequest()->getParam('page',1);
        $paginator->setCurrentPageNumber($currentPage);        
        $this->view->data=$paginator;
        $this->view->limit=$paginatorLimit;
        $this->view->page=$currentPage;
        $this->view->params=$params;
        $this->view->linhvuc = LinhVuc::SelectLinhVucList("");
        if($params['paginator']!=null)
        {
            $this->_helper->layout->disableLayout();
            $this->_helper->viewRenderer('index/danhsachtvgsok', null, true);
        }
    }

    public function danhsachtvgsnoAction() {
        $this->_helper->layout->disableLayout();
        $params=$this->getRequest()->getParams();
        $config = Zend_Registry::get('config');
        $data= tvgsModel::selectDanhSachTVGSKhongThamDinh($params);
        if((int)$params['hienthi']>0)
        {
            $paginatorLimit=$params['hienthi'];
        }
        else 
        {
            $paginatorLimit=$config->paginatorLimit;
        }
        $paginatorRange=$config->paginatorRange;
        $paginator = Zend_Paginator::factory($data);
        $paginator->setItemCountPerPage($paginatorLimit);       
        $paginator->setPageRange($paginatorRange);
        $currentPage = $this->getRequest()->getParam('page',1);
        $paginator->setCurrentPageNumber($currentPage);        
        $this->view->data=$paginator;
        $this->view->limit=$paginatorLimit;
        $this->view->page=$currentPage;
        $this->view->params=$params;
        $this->view->linhvuc = LinhVuc::SelectLinhVucList("");
        if($params['paginator']!=null)
        {
            $this->_helper->layout->disableLayout();
            $this->_helper->viewRenderer('index/danhsachtvgsno', null, true);
        }
    }

    public function danhsachtvgskhongcongboAction() {
        $this->_helper->layout->disableLayout();
        $params=$this->getRequest()->getParams();
        $config = Zend_Registry::get('config');
        $data= tvgsModel::selectDanhSachTVGSKhongCongBo($params);
        if((int)$params['hienthi']>0)
        {
            $paginatorLimit=$params['hienthi'];
        }
        else 
        {
            $paginatorLimit=$config->paginatorLimit;
        }
        $paginatorRange=$config->paginatorRange;
        $paginator = Zend_Paginator::factory($data);
        $paginator->setItemCountPerPage($paginatorLimit);       
        $paginator->setPageRange($paginatorRange);
        $currentPage = $this->getRequest()->getParam('page',1);
        $paginator->setCurrentPageNumber($currentPage);        
        $this->view->data=$paginator;
        $this->view->limit=$paginatorLimit;
        $this->view->page=$currentPage;
        $this->view->params=$params;
        $this->view->linhvuc = LinhVuc::SelectLinhVucList("");
        if($params['paginator']!=null)
        {
            $this->_helper->layout->disableLayout();
            $this->_helper->viewRenderer('index/danhsachtvgskhongcongbo', null, true);
        }
    }
    // Tu van thiet ke
    public function danhsachtvgsAction() {
        $this->_helper->layout->disableLayout();
        $params=$this->getRequest()->getParams();
        $config = Zend_Registry::get('config');
        $data= tvgsModel::selectDanhSachTVGSChoThamDinh($params);
        if((int)$params['hienthi']>0)
        {
            $paginatorLimit=$params['hienthi'];
        }
        else 
        {
            $paginatorLimit=$config->paginatorLimit;
        }
        $paginatorRange=$config->paginatorRange;
        $paginator = Zend_Paginator::factory($data);
        $paginator->setItemCountPerPage($paginatorLimit);       
        $paginator->setPageRange($paginatorRange);
        $currentPage = $this->getRequest()->getParam('page',1);
        $paginator->setCurrentPageNumber($currentPage);        
        $this->view->data=$paginator;
        $this->view->limit=$paginatorLimit;
        $this->view->page=$currentPage;
        $this->view->params=$params;
        $this->view->linhvuc = LinhVuc::SelectLinhVucList("");
        if($params['paginator']!=null)
        {
            $this->_helper->layout->disableLayout();
            $this->_helper->viewRenderer('index/danhsachtvgs', null, true);
        }
    }
}
